package com.example.xd.javatest.retrofit_test;

import android.util.Log;

import com.example.xd.javatest.retrofit_test.bean.Bean;
import com.example.xd.javatest.retrofit_test.bean.Bean1;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * @auther XuDan on 2020/6/28.
 */
public class RetrofitTest {
    public static void getdata() {
        NetApi netApi = RetrofitClient.getInstance().getNetApi();
        Call<Bean> call = netApi.getData();
        call.enqueue(new Callback<Bean>() {
            @Override
            public void onResponse(Call<Bean> call, Response<Bean> response) {
                Log.i("xd----", response.toString());
                Log.i("xd----", response.body().toString());
            }

            @Override
            public void onFailure(Call<Bean> call, Throwable t) {
                Log.i("xd----", "失败");

            }
        });
    }

    public static void getData1() {
        RetrofitClient.getInstance().getNetApi().getData1(405, 1).enqueue(new Callback<Bean1>() {
            @Override
            public void onResponse(Call<Bean1> call, Response<Bean1> response) {
                Log.i("xd----", response.body().getData().toString());

            }

            @Override
            public void onFailure(Call<Bean1> call, Throwable t) {

            }
        });
    }

}
